package rules.tree;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

import org.jdom.JDOMException;

//import tree.*;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 * @throws JDOMException 
	 * @throws FileNotFoundException 
	 */
	public static void main(String[] args) throws FileNotFoundException, JDOMException, IOException {
		Mapping mapping = new Mapping(new FileInputStream("C://Users/arida/Documents/NetBeansProjects/trunk/MappingTool/test/xml/mappingsVendas_eBay.xml"));
		
		//pegando atributo do head (testes)
		Head head = mapping.getRules().get(0).getHead();
		ClassAtom ca = (ClassAtom) head.getAtom();
		System.out.println(ca.getAttribute() + " " + ca.getVar().print());
		
		//pegando atributo do body (testes)
		Body bd = mapping.getRules().get(0).getBody();
		Object o = bd.getListAtom().get(0);
		ClassAtom ca2 = (ClassAtom) o;
		System.out.println(ca2.getAttribute());
		
		Object o2 = bd.getContext().getRestriction().getListAtom().get(0);
		PropertyAtom pa = (PropertyAtom) o2;
		System.out.println(pa.getAttribute());
		
		Body bd2 = mapping.getRules().get(1).getBody();
               //System.out.println( bd2.getContext().getElement().toString());
		Object o3 = bd2.getContext().getRestriction().getListAtom().get(0);
		PropertyAtom pa2 = (PropertyAtom) o3;
		System.out.println(pa2.getAttribute());
		
		
		System.out.println(mapping.getLocationSource());
		System.out.println(mapping.getOntoSource());
		System.out.println(mapping.getLocationTarget());
		System.out.println(mapping.getOntoTarget());
	}

}
